home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / tm480 / tmexam.exe / MENUONE.TSK < prev    next >
Text File  |  1991-09-10  |  4KB  |  148 lines

  1. ; Title   : MENUONE.TSK                 Last Updated : March 21, 1991
  2. ; Author  : Steve Johnson - FmP.        Version      : 1.10
  3. ; Purpose : Simple menu illustrating use of timeout.
  4. ; Notes   : A more practical example would allow parameters and paths
  5. ;           to be defined. The timeout would return you to a login
  6. ;           screen.
  7. ; Latest  : New syntax for SAVE and RESTORE
  8. ;         : Abandon use of ELEVEL.BAT
  9.  
  10. int line
  11.  
  12. var application,20      ; the current application
  13. var database,20         ; ditto
  14. var null,1
  15. var response,80
  16. var spreadsheet,20      ; ditto
  17. var tname,8," MENUONE"
  18. var wordprocessor,20    ; edited by option 4
  19.  
  20. vconst attention,79     ; highlight for timeout message
  21. vconst cel,55           ; clear to end of line
  22. vconst cep,56           ; clear to end of page
  23. vconst cls,11           ; clear screen and home cursor
  24.  
  25. end
  26.  
  27. forms logon.ovr ;in case /q and registered
  28. lookfor "menuone.ovr"
  29. if not found
  30.   insert tname tname
  31.   put "NO_FORMS"
  32.   stop
  33. fi
  34. lookfor "menuone.tm"
  35. if found
  36.   restore "menuone.tm" wordprocessor database spreadsheet
  37.   if resp ne 0
  38.     wait "MENUONE: Failure during restoration of data"
  39.     stop
  40.   fi
  41.   restore
  42. fi
  43. forms menuone.ovr
  44. move 8000h to bbmask         ;enable the <esc> key
  45. move true to hide             ;dont show programs names
  46. move 30 to timer              ;timeout in seconds
  47. cursor 0 25
  48. menu 1,"MENU"                 ;display the menu
  49. option 1,1                    ;all options execute same basic code
  50. option 1,2
  51. option 1,3
  52.   userline                    ;prevents TM switching to 24 line mode
  53.   cursor 20 0 cep             ;clear bottom of screen
  54.   if choice = 1               ;first topic was highlighted
  55.     move wordprocessor to application
  56.   else
  57.     if choice = 2             ;second topic was highlighted
  58.       move database to application
  59.     else
  60.       move spreadsheet to application        ;must have been the third...
  61.     fi
  62.   fi
  63.   trim application
  64.   if application ne null
  65.     move 255 to elevel
  66.     run application
  67.     add 1 to choice giving line
  68.     if elevel ne 0                ;display message on appropriate line
  69.       cursor line 47 "Error " elevel cel
  70.     else
  71.       clear response
  72.       scanvid 20 giving response
  73.       cursor 20 0 cel
  74.       sizevar response 32
  75.       cursor line 47 response cel
  76.     fi
  77.   else
  78.     display attention "Please enter application name via define option!" 
  79.     clear bbdisp
  80.   fi
  81.   return
  82. option 1,4          ;present program names for editing
  83.   fieldfill wordprocessor database spreadsheet
  84.   put "APPS_LIST"
  85.   if not anyfk
  86.     get wordprocessor database spreadsheet
  87.     save "menuone.tm" wordprocessor database spreadsheet
  88.     if resp ne 0
  89.       wait 'MENUONE: Unable to save data'
  90.       stop
  91.     fi
  92.     save
  93.   fi
  94.   return
  95. option 1,5          ;highlighted "quit" topic
  96. option 1,30         ;pressed <esc> key
  97.   stop
  98.  
  99. ; the following code only executed after a timeout
  100. option 1,99         ;timed out
  101.   cursor 12 15 attention " Sorry you have been timed out "
  102.   wait 2
  103.   stop
  104. endm 1
  105. endtask
  106.  
  107. @VIDEO
  108. @nf MENU
  109. @bright
  110. @col char,white,blue
  111. @window line 0,column 15,depth 11,width 29
  112. @GON
  113. @BBMENU yellow,blue
  114. 7-----------------------------9
  115. 0   7---------------------9   0
  116. 0   0  {Wordprocessing }   0   0
  117. 0   0     {Database }      0   0
  118. 0   0   {Spreadsheets }    0   0
  119. 0   0{Define Applications }0   0
  120. 0   4---------------------6   0
  121. 0   0      {Quit }         0   0
  122. 0   1---------------------3   0
  123. 0This menu will time out after0
  124. 0  30 seconds of inactivity   0
  125. 1-----------------------------3
  126. @END
  127. @nf APPS_LIST
  128. @acceptfk f10
  129. @string
  130. @string
  131. @string
  132. @colour char,yellow,black
  133. @WINDOW LINE1,COLUMN41,DEPTH6,WIDTH38
  134. @colour char,yellow,blue
  135. @bright
  136. @GON
  137. 9   1-Edit-and-<>:------9
  138. 4----[                    ]0
  139. 4----[                    ]0
  140. 4----[                    ]0
  141. 0    Please Note:           0
  142. 6    Full hierarchical name 0
  143. 0    required unless on PATH0
  144. 3   7---F10=Quit------------3
  145. @end
  146. @eof
  147.  
  148.